package com.conference.controller;

import com.conference.entity.UserConference;
import com.conference.service.UserConferenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/user-conferences")
public class UserConferenceController {

    @Autowired
    private UserConferenceService userConferenceService;

    /**
     * 获取会议的所有参会人员座位信息
     */
    @GetMapping("/conference/{conferenceId}/seats")
    public ResponseEntity<List<UserConference>> getConferenceSeats(@PathVariable Long conferenceId) {
        List<UserConference> seats = userConferenceService.getConferenceSeats(conferenceId);
        return ResponseEntity.ok(seats);
    }

    /**
     * 批量导入参会人员座位信息
     */
    @PostMapping("/conference/{conferenceId}/seats/import")
    public ResponseEntity<Map<String, Object>> importSeats(@PathVariable Long conferenceId,
                                                         @RequestBody List<UserConference> seats) {
        Map<String, Object> result = userConferenceService.importSeats(conferenceId, seats);
        return ResponseEntity.ok(result);
    }
} 